﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Reflection;
using System.IO;

namespace TerrariViewer
{
    public class Item
    {
        public Item()
        {
            this.Name = "";
            this.StackSize = 0;
        }

        public Item(string name)
        {
            this.Name = name;
        }

        public Item(string name, int stackSize)
        {
            this.Name = name;
            this.StackSize = stackSize;
        }

        private string name;
        private int stackSize;
        private string item;

        #region Item Image Dictionary

        public Dictionary<string, int> imageDic = new Dictionary<string, int> { 
                                    
                                    { "", 0 },
                                    { "No Item", 0 },

                                    // Weapons
                                    
                                    { "Aqua Scepter", 157 },
                                    { "Ball 'O Hurt", 162 },
                                    { "Blade of Grass", 190},
                                    { "Blue Moon", 163 },
                                    { "Blue Phaseblade", 198 },
                                    { "Copper Bow", 99 },
                                    { "Copper Broadsword", 4 },
                                    { "Copper Shortsword", 6 },
                                    { "Demon Bow", 44 },
                                    { "Enchanted Boomerang", 55 },
                                    { "Fiery Greatsword", 121 },
                                    { "Flamarang", 119 },
                                    { "Flamelash", 218 },
                                    { "Flintlock Pistol", 95 },
                                    { "Flower of Fire", 112 },
                                    { "Gold Bow", 99 },
                                    { "Gold Broadsword",  4 },
                                    { "Gold Shortsword", 6 },
                                    { "Green Phaseblade", 200 },
                                    { "Handgun", 164 },
                                    { "Harpoon", 160 },
                                    { "Iron Bow", 99 },
                                    { "Iron Broadsword", 4 },
                                    { "Iron Shortsword", 6 },
                                    { "Light's Bane", 46 },
                                    { "Magic Missile", 113 },
                                    { "Minishark", 98 },
                                    { "Molten Fury", 120 },
                                    { "Muramasa", 155 },
                                    { "Musket", 96 },
                                    { "Phoenix Blaster", 219 },
                                    { "Purple Phaseblade", 201 },
                                    { "Red Phaseblade", 199 },
                                    { "Silver Bow", 99 },
                                    { "Silver Broadsword", 4 },
                                    { "Silver Shortsword", 6 },
                                    { "Space Gun", 127 },
                                    { "Staff of Regrowth", 213 },
                                    { "Starfury", 65 },
                                    { "Star Cannon", 197 },
                                    { "Sunfury", 220 },
                                    { "Thorn Chakrum", 191 },
                                    { "Vilethorn", 64 },
                                    { "Water Bolt", 165 },
                                    { "White Phaseblade", 202 },
                                    { "Wooden Bow", 39 },
                                    { "Wooden Sword", 24 },
                                    { "Yellow Phaseblade", 203 },
                            
                                    // Tools

                                    { "Copper Axe", 10 },
                                    { "Copper Hammer", 7 },
                                    { "Copper Pickaxe", 1 },
                                    { "Gold Axe", 10 },
                                    { "Gold Hammer", 7 },
                                    { "Gold Pickaxe", 1 },
                                    { "Grappling Hook", 84 },
                                    { "Iron Axe", 10 },
                                    { "Iron Hammer", 7 },
                                    { "Iron Pickaxe", 1 },
                                    { "Ivy Whip", 185 },
                                    { "Meteor Hamaxe", 204 },
                                    { "Molten Hamaxe", 217 },
                                    { "Molten Pickaxe", 122 },
                                    { "Nightmare Pickaxe", 103 },
                                    { "Silver Axe", 10 },
                                    { "Silver Hammer", 7 },
                                    { "Silver Pickaxe", 1 },
                                    { "The Breaker", 104 },
                                    { "War Axe of the Night", 45 },
                                    { "Wooden Hammer", 196 },

                                    // Armor

                                    { "Archaeologist's Hat", 251 },
                                    { "Archaeologist's Jacket", 252 },
                                    { "Archaeologist's Pants", 253 },
                                    { "Bunny Hood", 243 },
                                    { "Copper Chainmail", 80 },
                                    { "Copper Greaves", 76 },
                                    { "Copper Helmet", 89 },
                                    { "Fish Bowl", 250 },
                                    { "Goggles", 37 },
                                    { "Gold Chainmail", 83 },
                                    { "Gold Crown", 264 },
                                    { "Gold Greaves", 79 },
                                    { "Gold Helmet", 92 },
                                    { "Hero's Hat", 247 },
                                    { "Hero's Shirt", 248 },
                                    { "Hero's Pants", 249 },
                                    { "Iron Chainmail", 81 },
                                    { "Iron Greaves", 77 },
                                    { "Iron Helmet", 90 },
                                    { "Jungle Hat", 228 },
                                    { "Jungle Pants", 230 },
                                    { "Jungle Rose", 208 },
                                    { "Jungle Shirt", 229 },
                                    { "Meteor Helmet", 123 },
                                    { "Meteor Leggings", 125 },
                                    { "Meteor Suit", 124 },
                                    { "Mining Helmet", 88 },
                                    { "Molten Breastplate", 232 },
                                    { "Molten Greaves", 233 },
                                    { "Molten Helmet", 231 },
                                    { "Necro Breastplate", 152 },
                                    { "Necro Greaves", 153 },
                                    { "Necro Helmet", 151 },
                                    { "Ninja Hood", 256 },
                                    { "Ninja Shirt", 257 },
                                    { "Ninja Pants", 258 },
                                    { "Plumber's Hat", 244 },
                                    { "Plumber's Pants", 246 },
                                    { "Plumber's Shirt", 245 },
                                    { "Red Hat", 260 },
                                    { "Robe",262 },
                                    { "Robot Hat", 263 },                                    
                                    { "Shadow Greaves", 100 },
                                    { "Shadow Helmet", 102 },
                                    { "Shadow Scalemail", 101 },
                                    { "Silver Chainmail", 82 },
                                    { "Silver Greaves", 78 },
                                    { "Silver Helmet", 91 },
                                    { "Summer Hat", 242 },
                                    { "Sunglasses", 237 },
                                    { "Top Hat", 239 },
                                    { "Tuxedo Pants", 241 },
                                    { "Tuxedo Shirt", 240 },
                                    { "Wizard Hat", 238 },

                                    // Accessories

                                    { "Anklet of the Wind", 212 },
                                    { "Band of Regeneration", 49 },
                                    { "Band of Starpower", 111 },
                                    { "Cloud in a Bottle", 31 },
                                    { "Cobalt Shield", 156 },
                                    { "Copper Watch", 15 },
                                    { "Depth Meter", 18 },
                                    { "Feral Claws", 211 },
                                    { "Flipper", 187 },
                                    { "Gold Watch", 17 },
                                    { "Hermes Boots", 54 },
                                    { "Lucky Horseshoe", 158 },
                                    { "Nature's Gift", 223 },
                                    { "Obsidian Skull", 193 },
                                    { "Rocket Boots", 128 },
                                    { "Shackle", 216 },
                                    { "Shiny Red Balloon", 159 },
                                    { "Silver Watch", 16 },

                                    // Blocks, Ore, Walls, Bars
                                    
                                    { "Ash Block", 172  },
                                    { "Blue Brick", 134 },
                                    { "Blue Brick Wall", 135 },
                                    { "Clay Block", 133 },
                                    { "Copper Bar", 20 },
                                    { "Copper Brick", 145 },
                                    { "Copper Brick Wall", 146 },
                                    { "Copper Ore", 12 },
                                    { "Demonite Bar", 57 },
                                    { "Demonite Ore", 56 },
                                    { "Ebonstone Block", 61 },
                                    { "Dirt Block", 2 },
                                    { "Dirt Wall", 30 },
                                    { "Glass", 170 },
                                    { "Gold Bar", 19 },
                                    { "Gold Brick", 141 },
                                    { "Gold Brick Wall", 142 },
                                    { "Gold Ore", 13 },
                                    { "Gray Brick", 129 },
                                    { "Gray Brick Wall", 130 },
                                    { "Green Brick", 137 },
                                    { "Green Brick Wall", 138 },
                                    { "Hellstone", 174 },
                                    { "Hellstone Bar", 175 },
                                    { "Hellstone Brick", 214 }, 
                                    { "Iron Bar", 22 },
                                    { "Iron Ore", 11 },
                                    { "Meteorite Bar", 117 },
                                    { "Meteorite", 116 },
                                    { "Mud Block", 176 },
                                    { "Obsidian", 173 },
                                    { "Obsidian Brick", 192 },
                                    { "Pink Brick", 139 },
                                    { "Pink Brick Wall", 140 },
                                    { "Red Brick", 131 },
                                    { "Red Brick Wall", 132},
                                    { "Sand Block", 169},
                                    { "Silver Bar", 21 },
                                    { "Silver Brick", 143},
                                    { "Silver Brick Wall", 144},
                                    { "Silver Ore", 14 },
                                    { "Spike", 147 },
                                    { "Stone Block", 3 },
                                    { "Stone Wall", 26 },
                                    { "Wood", 9 },
                                    { "Wood Wall", 93 },

                                    // Consumables

                                    { "Acorn", 27 },
                                    { "Bomb", 166 },
                                    { "Bone", 154 },
                                    { "Corrupt Seeds", 59 },
                                    { "Dynamite", 167 },
                                    { "Fallen Star", 75 },
                                    { "Flaming Arrow", 41 },
                                    { "Glowing Mushroom", 183 },
                                    { "Goldfish", 261 },
                                    { "Grass Seeds", 62  },
                                    { "Grenade", 168 },
                                    { "Healing Potion", 188 },
                                    { "Jester's Arrow", 51 },
                                    { "Jungle Grass Seeds", 195 },
                                    { "Lesser Healing Potion", 28 },
                                    { "Lesser Mana Potion", 110 },
                                    { "Lesser Restoration Potion", 226 },
                                    { "Life Crystal", 29 },
                                    { "Mana Crystal", 109 },
                                    { "Mana Potion", 189 },
                                    { "Meteor Shot", 234 },
                                    { "Mushroom", 5 },
                                    { "Mushroom Grass Seeds", 194 },
                                    { "Musket Ball", 97 },
                                    { "Purification Powder", 66 },
                                    { "Restoration Potion", 227 },
                                    { "Shuriken", 42 },
                                    { "Spiky Ball", 161 },
                                    { "Sticky Bomb", 235 },
                                    { "Sunflower", 63 },
                                    { "Suspicious Looking Eye", 43 },
                                    { "Unholy Arrow", 47 },
                                    { "Vile Powder", 67 },
                                    { "Wood Platform", 94 },
                                    { "Wooden Arrow", 40 },
                                    { "Worm Food", 70 },

                                    // Furniture/Lighting

                                    { "Bed", 224 },
                                    { "Book", 149 },
                                    { "Bottle", 500 },
                                    { "Candle", 105 },
                                    { "Chain Lantern", 136 },
                                    { "Chest", 48 },
                                    { "Clay Pot", 222 },
                                    { "Copper Chandelier", 106 },
                                    { "Furnace", 33 },
                                    { "Gold Chandelier", 108 },
                                    { "Hellforge", 221 },
                                    { "Iron Anvil", 35 },
                                    { "Piggy Bank", 87 },
                                    { "Sign", 171 },
                                    { "Silver Chandelier", 107 },
                                    { "Torch", 8 },
                                    { "Water Candle", 148 },                                    
                                    { "Wooden Chair", 34 },
                                    { "Wooden Door", 25 },
                                    { "Wooden Table", 32 },
                                    { "Work Bench", 36 },

                                    // Miscellaneous

                                    { "Amethyst", 181 },
                                    { "Angel Statue", 52 },
                                    { "Black Dye", 254 },
                                    { "Black Lens", 236 },
                                    { "Breathing Reed", 186 },
                                    { "Cobweb", 150 },
                                    { "Copper Coin", 71 },
                                    { "Diamond", 182 },
                                    { "Dirt Rod", 114 },
                                    { "Emerald", 179 },
                                    { "Empty Bucket", 205 },
                                    { "Gel", 23 },
                                    { "Gold Coin", 73 },
                                    { "Green Dye", 255 },
                                    { "Hook", 118 },
                                    { "Iron Chain", 85 },
                                    { "Lava Bucket", 207 },
                                    { "Leather", 259 },
                                    { "Lens", 38 },
                                    { "Magic Mirror", 50 },
                                    { "Orb of Light", 115 },
                                    { "Platinum Coin", 74 },
                                    { "Rotten Chunk", 68 },
                                    { "Ruby", 178 },
                                    { "Sapphire", 177 },
                                    { "Shadow Scale", 86 },
                                    { "Silk", 225 },
                                    { "Silver Coin", 72 },
                                    { "Stinger", 209 },
                                    { "Topaz", 180 },
                                    { "Vile Mushroom", 60 },
                                    { "Vine", 210 },
                                    { "Water Bucket", 206 },
                                    { "Whoopie Cushion", 215 },
                                    { "Worm Tooth", 69 },

                                    // Version 1.0.5

                                    { "Mime Mask", 322 },
                                    { "Aglet", 285 },
                                    { "Hellfire Arrow", 265 },
                                    { "Sandgun", 266 },
                                    { "Guide Voodoo Doll",  267 },
                                    { "Familiar Wig", 271 },
                                    { "Familiar Pants", 270 },
                                    { "Familiar Shirt", 269 },
                                    { "The Doctor's Shirt", 325 },
                                    { "The Doctor's Pants", 326 },
                                    { "Diving Helmet", 268 },
                                    { "Night's Edge", 273 },
                                    { "Dark Lance", 274 },
                                    { "Demon Scythe", 272 },
                                    { "Trident", 277 },
                                    { "Coral", 275 },
                                    { "Cactus", 276 },
                                    { "Spear", 280 },
                                    { "Glowstick", 282 },
                                    { "Sticky Glowstick", 286 },
                                    { "Throwing Knife", 279 },
                                    { "Poisoned Knife", 287 },
                                    { "Silver Bullet", 278 },
                                    { "Wooden Boomerang", 284 },
                                    { "Blowpipe", 281 },
                                    { "Seed", 283 },
                                    { "Obsidian Skin Potion", 288 },
                                    { "Regeneration Potion", 289 },
                                    { "Swiftness Potion", 290 },
                                    { "Gills potion", 291 },
                                    { "Ironskin Potion", 292 },
                                    { "Mana Regeneration Potion", 293 },
                                    { "Magic Power Potion", 294 },
                                    { "Featherfall Potion", 295 },
                                    { "Spelunker Potion", 296 },
                                    { "Invisibility Potion", 297 },
                                    { "Shine Potion", 298 },
                                    { "Night Owl Potion", 299 },
                                    { "Battle Potion", 300 },
                                    { "Thorns Potion",301 },
                                    { "Archery Potion", 303 },
                                    { "Water Walking Potion", 302 },
                                    { "Hunter Potion",  304 },
                                    { "Gravitation Potion", 305 },
                                    { "Daybloom", 313 },
                                    { "Daybloom Seeds", 307 },
                                    { "Moonglow", 314 },
                                    { "Moonglow Seeds", 308 },
                                    { "Blinkroot", 315 },
                                    { "Blinkroot Seeds", 309 },
                                    { "Deathweed", 316 },
                                    { "Deathweed Seeds", 310 },
                                    { "Waterleaf", 317 },
                                    { "Waterleaf Seeds", 311 },
                                    { "Fireblossom", 318 },
                                    { "Fireblossom Seeds", 312 },
                                    { "Shark Fin", 319 },
                                    { "Feather", 320 },
                                    { "Gold Chest", 306 },
                                    { "Bottled Water", 126 },
                                    { "Tombstone", 321 },
                                    { "Illegal Gun Parts", 324 },
                                    { "Antlion Mandible", 323 },

                                    // Version 1.0.6
                                    
                                    { "Golden Key", 327 },
                                    { "Shadow Chest", 328 },
                                    { "Shadow Key", 329 },
                                    { "Obsidian Brick Wall", 330 },
                                    { "Jungle Spores", 331 },
                                    { "Piano", 333 },
                                    { "Red Banner", 337 },
                                    { "Green Banner", 338 },
                                    { "Blue Banner", 339 },
                                    { "Yellow Banner", 340 },
                                    { "Chinese Lantern", 344 },
                                    { "Barrel", 343 },
                                    { "Cooking Pot", 345 },
                                    { "Safe", 346 },
                                    { "Pink Vase", 350 },
                                    { "Mug", 351 },
                                    { "Keg", 352 },
                                    { "Ale", 353 },
                                    { "Bookcase", 354 },
                                    { "Candelabra", 349 },
                                    { "Trash Can", 348 },
                                    { "Throne", 355 },
                                    { "Bowl", 356 },
                                    { "Bowl of Soup", 357 },
                                    { "Toilet", 358 },
                                    { "Grandfather Clock", 359 },
                                    { "Statue", 360 },
                                    { "Bathtub", 336 },
                                    { "Skull Lantern", 347 },
                                    { "Tiki Torch", 342 },
                                    { "Lamp Post", 341 },
                                    { "Dresser", 334 },
                                    { "Goblin Battle Standard", 361 },
                                    { "Tattered Cloth", 362 },
                                    { "Bench", 335 },
                                    { "Loom", 332 },
                                    { "Mud Wall", 176 },
                                    { "Sawmill", 363 },
        };

        #endregion

        #region Max Stack Dictionary

        public Dictionary<string, int> stackDic = new Dictionary<string, int> {
                                    
                                    { "", 0 },
                                    { "No Item", 0 },

                                    // Weapons
                                    
                                    { "Aqua Scepter", 1 },
                                    { "Ball 'O Hurt", 1 },
                                    { "Blade of Grass", 1 },
                                    { "Blue Moon", 1 },
                                    { "Blue Phaseblade", 1 },
                                    { "Copper Bow", 1 },
                                    { "Copper Broadsword", 1 },
                                    { "Copper Shortsword", 1 },
                                    { "Demon Bow", 1 },
                                    { "Enchanted Boomerang", 1 },
                                    { "Fiery Greatsword", 1 },
                                    { "Flamarang", 1},
                                    { "Flamelash", 1 },
                                    { "Flintlock Pistol", 1 },
                                    { "Flower of Fire", 1 },
                                    { "Gold Bow",  1 },
                                    { "Gold Broadsword", 1 },
                                    { "Gold Shortsword", 1 },
                                    { "Green Phaseblade", 1 },
                                    { "Handgun", 1 },
                                    { "Harpoon", 1 },
                                    { "Iron Bow", 1 },
                                    { "Iron Broadsword", 1 },
                                    { "Iron Shortsword", 1 },
                                    { "Light's Bane", 1 },
                                    { "Magic Missile", 1 },
                                    { "Minishark", 1 },
                                    { "Molten Fury", 1 },
                                    { "Muramasa", 1 },
                                    { "Musket", 1 },
                                    { "Phoenix Blaster", 1 },
                                    { "Purple Phaseblade", 1 },
                                    { "Red Phaseblade", 1 },
                                    { "Silver Bow", 1 },
                                    { "Silver Broadsword", 1 },
                                    { "Silver Shortsword", 1 },
                                    { "Space Gun", 1 },
                                    { "Staff of Regrowth", 1 },
                                    { "Starfury", 1 },
                                    { "Star Cannon", 1 },
                                    { "Sunfury", 1 },
                                    { "Thorn Chakrum", 1 },
                                    { "Vilethorn", 1 },
                                    { "Water Bolt", 1 },
                                    { "White Phaseblade", 1 },
                                    { "Wooden Bow", 1 },
                                    { "Wooden Sword", 1 },
                                    { "Yellow Phaseblade", 1 },
                            
                                    // Tools

                                    { "Copper Axe", 1 },
                                    { "Copper Hammer", 1 },
                                    { "Copper Pickaxe", 1 },
                                    { "Gold Axe", 1 },
                                    { "Gold Hammer", 1 },
                                    { "Gold Pickaxe", 1 },
                                    { "Grappling Hook", 1 },
                                    { "Iron Axe", 1 },
                                    { "Iron Hammer", 1 },
                                    { "Iron Pickaxe", 1 },
                                    { "Ivy Whip", 1 },
                                    { "Meteor Hamaxe", 1 },
                                    { "Molten Hamaxe", 1 },
                                    { "Molten Pickaxe", 1 },
                                    { "Nightmare Pickaxe", 1 },
                                    { "Silver Axe", 1 },
                                    { "Silver Hammer", 1 },
                                    { "Silver Pickaxe", 1 },
                                    { "The Breaker", 1 },
                                    { "War Axe of the Night", 1 },
                                    { "Wooden Hammer", 1 },

                                    // Armor

                                    { "Archaeologist's Hat", 1 },
                                    { "Archaeologist's Jacket", 1 },
                                    { "Archaeologist's Pants", 1 },
                                    { "Bunny Hood", 1 },
                                    { "Copper Chainmail", 1 },
                                    { "Copper Greaves", 1 },
                                    { "Copper Helmet", 1 },
                                    { "Fish Bowl", 1 },
                                    { "Goggles", 1 },
                                    { "Gold Chainmail", 1 },
                                    { "Gold Crown", 1 },
                                    { "Gold Greaves", 1 },
                                    { "Gold Helmet", 1 },
                                    { "Hero's Hat", 1 },
                                    { "Hero's Shirt", 1 },
                                    { "Hero's Pants", 1 },
                                    { "Iron Chainmail", 1 },
                                    { "Iron Greaves", 1 },
                                    { "Iron Helmet", 1 },
                                    { "Jungle Hat", 1 },
                                    { "Jungle Pants", 1 },
                                    { "Jungle Rose", 99 },
                                    { "Jungle Shirt", 1 },
                                    { "Meteor Helmet", 1 },
                                    { "Meteor Leggings", 1 },
                                    { "Meteor Suit", 1 },
                                    { "Mining Helmet", 1 },
                                    { "Molten Breastplate", 1 },
                                    { "Molten Greaves", 1 },
                                    { "Molten Helmet", 1 },
                                    { "Necro Breastplate", 1 },
                                    { "Necro Greaves", 1 },
                                    { "Necro Helmet", 1 },
                                    { "Ninja Hood", 1 },
                                    { "Ninja Shirt", 1 },
                                    { "Ninja Pants", 1 },
                                    { "Plumber's Hat", 1 },
                                    { "Plumber's Pants", 1 },
                                    { "Plumber's Shirt", 1 },
                                    { "Red Hat", 1 },
                                    { "Robe", 1 },
                                    { "Robot Hat", 1 },                                    
                                    { "Shadow Greaves", 1 },
                                    { "Shadow Helmet", 1 },
                                    { "Shadow Scalemail", 1 },
                                    { "Silver Chainmail", 1 },
                                    { "Silver Greaves", 1 },
                                    { "Silver Helmet", 1 },
                                    { "Summer Hat", 1 },
                                    { "Sunglasses", 1 },
                                    { "Top Hat", 1 },
                                    { "Tuxedo Pants", 1 },
                                    { "Tuxedo Shirt", 1 },
                                    { "Wizard Hat", 1 },

                                    // Accessories

                                    { "Anklet of the Wind", 1 },
                                    { "Band of Regeneration", 1 },
                                    { "Band of Starpower", 1 },
                                    { "Cloud in a Bottle", 1 },
                                    { "Cobalt Shield", 1 },
                                    { "Copper Watch", 1 },
                                    { "Depth Meter", 1 },
                                    { "Feral Claws", 1 },
                                    { "Flipper", 1 },
                                    { "Gold Watch", 1 },
                                    { "Hermes Boots", 1 },
                                    { "Lucky Horseshoe", 1 },
                                    { "Nature's Gift", 1 },
                                    { "Obsidian Skull", 1 },
                                    { "Rocket Boots", 1 },
                                    { "Shackle", 1 },
                                    { "Shiny Red Balloon", 1 },
                                    { "Silver Watch", 1 },

                                    // Blocks, Ore, Walls, Bars
                                    
                                    { "Ash Block", 250 },
                                    { "Blue Brick", 250 },
                                    { "Blue Brick Wall", 250 },
					                { "Clay Block", 250 },
                                    { "Copper Bar", 99 },
                                    { "Copper Brick",  250 },
                                    { "Copper Brick Wall", 250 },
                                    { "Copper Ore", 99 },
                                    { "Demonite Bar", 99 },
                                    { "Demonite Ore", 99 },
                                    { "Dirt Block", 250 },
                                    { "Dirt Wall", 250 },
					                { "Ebonstone Block", 250 },
                                    { "Glass", 250 },
                                    { "Gold Bar", 99 },
                                    { "Gold Brick", 250 },
                                    { "Gold Brick Wall", 250 },
                                    { "Gold Ore", 99 },
                                    { "Gray Brick", 250 },
                                    { "Gray Brick Wall", 250 },
                                    { "Green Brick", 250 },		
                                    { "Green Brick Wall", 250 },
                                    { "Hellstone", 250 },
                                    { "Hellstone Bar", 99 },
					                { "Hellstone Brick", 250 },
                                    { "Iron Bar", 99 },
                                    { "Iron Ore", 99 },
                                    { "Meteorite Bar", 99 },
                                    { "Meteorite", 250 },
					                { "Mud Block", 250 },
                                    { "Obsidian", 250 },
                                    { "Obsidian Brick", 250 },
                                    { "Pink Brick", 250 },
                                    { "Pink Brick Wall", 250 },
                                    { "Red Brick", 250 },
                                    { "Red Brick Wall", 250 },
                                    { "Sand Block", 250 },
                                    { "Silver Bar", 99 },
                                    { "Silver Brick",  250 },
                                    { "Silver Brick Wall", 250 },
                                    { "Silver Ore", 99 },
                                    { "Spike", 250 },
                                    { "Stone Block", 250 },
                                    { "Stone Wall", 250 },
                                    { "Wood", 250 },
                                    { "Wood Wall", 250 },

                                    // Consumables

                                    { "Acorn", 99 },
                                    { "Bomb", 20 },
                                    { "Bone", 99 },
                                    { "Corrupt Seeds", 99 },
                                    { "Dynamite", 3 },
                                    { "Fallen Star", 99 },
                                    { "Flaming Arrow", 250 },
                                    { "Glowing Mushroom", 99 },
                                    { "Goldfish", 20 },
                                    { "Grass Seeds", 99 },
                                    { "Grenade", 20 },
                                    { "Healing Potion", 30 },
                                    { "Jester's Arrow", 250 },
                                    { "Jungle Grass Seeds", 99 },
                                    { "Lesser Healing Potion", 30 },
                                    { "Lesser Mana Potion", 30 },
                                    { "Lesser Restoration Potion", 30 },
                                    { "Life Crystal", 99 },
                                    { "Mana Crystal", 99 },
                                    { "Mana Potion", 30 },
                                    { "Meteor Shot", 250 },
                                    { "Mushroom", 99 },
                                    { "Mushroom Grass Seeds", 99 },
                                    { "Musket Ball", 250 },
                                    { "Purification Powder", 99 },
                                    { "Restoration Potion", 30 },
                                    { "Shuriken", 250 },
                                    { "Spiky Ball", 250 },
                                    { "Sticky Bomb", 20 },
                                    { "Sunflower", 99 },
                                    { "Suspicious Looking Eye", 1 },
                                    { "Unholy Arrow", 250 },
                                    { "Vile Powder", 99 },
                                    { "Wood Platform", 99 },
                                    { "Wooden Arrow", 250 },
                                    { "Worm Food", 1 },

                                    // Furniture/Lighting

                                    { "Bed", 99 },
                                    { "Book", 99 },
                                    { "Bottle", 99 },
                                    { "Candle", 99 },
                                    { "Chain Lantern", 99 },
                                    { "Chest", 99 },
                                    { "Clay Pot", 99 },
                                    { "Copper Chandelier", 99 },
                                    { "Furnace", 99 },
                                    { "Gold Chandelier", 99 },
                                    { "Hellforge", 99 },
                                    { "Iron Anvil", 99 },
                                    { "Piggy Bank", 99 },
                                    { "Sign", 99 },
                                    { "Silver Chandelier", 99 },
                                    { "Torch", 99 },
                                    { "Water Candle", 99 },                                    
                                    { "Wooden Chair", 99 },
                                    { "Wooden Door", 99 },
                                    { "Wooden Table", 99 },
                                    { "Work Bench", 99 },

                                    // Miscellaneous

                                    { "Amethyst", 99 },
                                    { "Angel Statue", 1 },
                                    { "Black Dye", 99 },
                                    { "Black Lens", 99 },
                                    { "Breathing Reed", 1 },
                                    { "Cobweb", 250 },
                                    { "Copper Coin", 100 },
                                    { "Diamond", 99 },
                                    { "Dirt Rod", 1 },
                                    { "Emerald", 99 },
                                    { "Empty Bucket", 1 },
                                    { "Gel", 99 },
                                    { "Gold Coin", 100 },
                                    { "Green Dye", 99 },
                                    { "Hook",  99 },
                                    { "Iron Chain", 99 },
                                    { "Lava Bucket", 1 },
                                    { "Leather", 99 },
                                    { "Lens", 99 },
                                    { "Magic Mirror", 1 },
                                    { "Orb of Light", 1 },
                                    { "Platinum Coin", 100 },
                                    { "Rotten Chunk", 99 },
                                    { "Ruby", 99 },
                                    { "Sapphire", 99 },
                                    { "Shadow Scale", 99 },
                                    { "Silk", 99 },
                                    { "Silver Coin", 100 },
                                    { "Stinger", 99 },
                                    { "Topaz", 99 },
                                    { "Vile Mushroom", 99 },
                                    { "Vine", 99 },
                                    { "Water Bucket", 1 },
                                    { "Whoopie Cushion", 1 },
                                    { "Worm Tooth", 99 },

                                    // Version 1.0.5

                                    { "Mime Mask", 1 },
                                    { "Aglet" , 1},
                                    { "Hellfire Arrow", 250 },
                                    { "Sandgun", 1 },
                                    { "Guide Voodoo Doll", 1 },
                                    { "Familiar Wig", 1 },
                                    { "Familiar Pants", 1 },
                                    { "Familiar Shirt", 1 },
                                    { "The Doctor's Shirt", 1 },
                                    { "The Doctor's Pants", 1 },
                                    { "Diving Helmet", 1 },
                                    { "Night's Edge", 1 },
                                    { "Dark Lance", 1 },
                                    { "Demon Scythe", 1 },
                                    { "Trident", 1 },
                                    { "Coral", 99 },
                                    { "Cactus", 99 },
                                    { "Spear", 99 },
                                    { "Glowstick", 99 },
                                    { "Sticky Glowstick", 99 },
                                    { "Throwing Knife", 250 },
                                    { "Poisoned Knife", 250 },
                                    { "Silver Bullet", 250 },
                                    { "Wooden Boomerang", 1 },
                                    { "Blowpipe", 1 },
                                    { "Seed", 250 },
                                    { "Obsidian Skin Potion", 30 },
                                    { "Regeneration Potion", 30 },
                                    { "Swiftness Potion", 30 },
                                    { "Gills potion", 30 },
                                    { "Ironskin Potion", 30 },
                                    { "Mana Regeneration Potion", 30 },
                                    { "Magic Power Potion", 30 },
                                    { "Featherfall Potion", 30 },
                                    { "Spelunker Potion", 30 },
                                    { "Invisibility Potion", 30 },
                                    { "Shine Potion", 30 },
                                    { "Night Owl Potion", 30 },
                                    { "Battle Potion", 30 },
                                    { "Thorns Potion", 30 },
                                    { "Archery Potion", 30 },
                                    { "Water Walking Potion", 30 },
                                    { "Hunter Potion", 30 },
                                    { "Gravitation Potion", 30 },
                                    { "Daybloom", 99 },
                                    { "Daybloom Seeds", 99 },
                                    { "Moonglow", 99 },
                                    { "Moonglow Seeds", 99 },
                                    { "Blinkroot", 99 },
                                    { "Blinkroot Seeds", 99 },
                                    { "Deathweed", 99 },
                                    { "Deathweed Seeds", 99 },
                                    { "Waterleaf", 99 },
                                    { "Waterleaf Seeds", 99 },
                                    { "Fireblossom", 99 },
                                    { "Fireblossom Seeds", 99 },
                                    { "Shark Fin", 99 },
                                    { "Feather", 99 },
                                    { "Gold Chest", 99 },
                                    { "Bottled Water", 30 },
                                    { "Tombstone", 99 },
                                    { "Illegal Gun Parts", 99 },
                                    { "Antlion Mandible", 99 },

                                    // Version 1.0.6
                                    
                                    { "Golden Key", 99 },
                                    { "Shadow Chest", 99 },
                                    { "Shadow Key", 1 },
                                    { "Obsidian Brick Wall", 250 },
                                    { "Jungle Spores", 99 },
                                    { "Piano", 99 },
                                    { "Red Banner", 99 },
                                    { "Green Banner", 99 },
                                    { "Blue Banner", 99 },
                                    { "Yellow Banner", 99 },
                                    { "Chinese Lantern", 99 },
                                    { "Barrel", 99 },
                                    { "Cooking Pot", 99 },
                                    { "Safe", 99 },
                                    { "Pink Vase", 99 },
                                    { "Mug", 99 },
                                    { "Keg", 99 },
                                    { "Ale", 99 },
                                    { "Bookcase", 99 },
                                    { "Candelabra", 99 },
                                    { "Trash Can", 99 },
                                    { "Throne", 99 },
                                    { "Bowl", 99 },
                                    { "Bowl of Soup", 99 },
                                    { "Toilet", 99 },
                                    { "Grandfather Clock", 99 },
                                    { "Statue", 99 },
                                    { "Bathtub", 99 },
                                    { "Skull Lantern", 99 },
                                    { "Tiki Torch", 99 },
                                    { "Lamp Post", 99 },
                                    { "Dresser", 99 },
                                    { "Goblin Battle Standard", 1 },
                                    { "Tattered Cloth", 99 },
                                    { "Bench", 99 },
                                    { "Loom", 99 },
                                    { "Mud Wall", 250 },
                                    { "Sawmill", 99 },
        };

        #endregion

        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }

        public int StackSize
        {
            get { return this.stackSize; }
            set { this.stackSize = value; }
        }

        /// <summary>
        /// Gives an image based on the item name given
        /// </summary>
        /// <param name="img">The name of the item to create an image for</param>
        /// <returns>Retrurns image associated with the item in question</returns>
        public System.Drawing.Image ItemImage(string img)
        {
            try
            {  
                System.Reflection.Assembly thisExe;
                thisExe = System.Reflection.Assembly.GetExecutingAssembly();
                item = "TerrariViewer.Resources.Item_" + imageDic[img] + ".png";
                System.IO.Stream file = thisExe.GetManifestResourceStream(item);
                return Image.FromStream(file);

            }
            catch
            {
                return null;
            }
        }

        /// <summary>
        /// Gives an image for the itemDic Dictionary collection
        /// </summary>
        /// <returns>Returns an image associated with the item in question</returns>
        public System.Drawing.Image ItemImage()
        {
            try
            {
                System.Reflection.Assembly thisExe;
                thisExe = System.Reflection.Assembly.GetExecutingAssembly();
                item = "TerrariViewer.Resources.Item_" + imageDic[this.Name] + ".png";
                System.IO.Stream file = thisExe.GetManifestResourceStream(item);
                return Image.FromStream(file);
            }
            catch
            {
                return null;
            }
        }

        /// <summary>
        /// Returns the max stack size for an item
        /// </summary>
        /// <returns>Returns an integer representing the max stack size</returns>
        public int ItemMaxStack()
        {
            try
            {
                return stackDic[this.Name];
            }
            catch
            {
                return 0;
            }            
        }

        public override string ToString()
        {
            return this.Name + "\n\nAmt:  " + this.StackSize;
        }
    }
}
